﻿using PureMVC.Interfaces;
using PureMVC.Patterns;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

///<summary>
///
///</summary>
public class IntroMediator : Mediator
{
    public new static string NAME = "IntroMediator";

    IntroView view;
    public IntroView introView
    {
        get { return (IntroView)base.ViewComponent; }
    }
    public IntroMediator() :base(NAME)
    {
        view = GameObject.Find("Canvas/View").GetComponent<IntroView>();
        view.Init();
    }
    public override IList<string> ListNotificationInterests()
    {
        IList<string> notifications = new List<string>();
        notifications.Add(GameEvents.LOADING_END);
        notifications.Add(GameEvents.INTRO_END);
        return notifications;
    }
    public override void HandleNotification(INotification notification)
    {
        switch (notification.Name)
        {
            case GameEvents.LOADING_END:
                StateManager.GetInstance.IsSkipStartScnen = true;
                break;
            case GameEvents.INTRO_END:
                view.PlayLoadingEndAnimation();
                break;
        }
    }
}
